Skip to content

feat: add SiftQ provider with OpenAI-compatible video APIs - #2443

Open
futurestudyspace wants to merge 1 commit into
songquanpeng:mainfrom
siftq:feat/siftq-provider
Open

feat: add SiftQ provider with OpenAI-compatible video APIs#2443
futurestudyspace wants to merge 1 commit into
songquanpeng:mainfrom
siftq:feat/siftq-provider

Conversation

@futurestudyspace

Copy link
Copy Markdown

close #2442

Overview

This PR introduces two related modules:

  1. OpenAI-compatible asynchronous video APIs.
  2. An independent SiftQ provider for the MiniMax-H3 video model.

Module 1: OpenAI-compatible Video APIs

Endpoints

Method Endpoint Description
POST /v1/videos Create a video generation job
GET /v1/videos/{video_id} Retrieve a video job
GET /v1/videos List the current user's video jobs
GET /v1/videos/{video_id}/content Download completed video content
DELETE /v1/videos/{video_id} Cancel or delete a video job

These endpoints use the existing One API token authentication and model permission mechanisms.

Create requests

Both JSON and multipart/form-data requests are supported.

JSON example:

{
  "model": "MiniMax-H3",
  "prompt": "A cinematic ocean sunrise",
  "seconds": "5",
  "size": "1280x720"
}

Multipart example:

curl http://127.0.0.1:3000/v1/videos \
  -H "Authorization: Bearer $ONE_API_TOKEN" \
  -F "model=MiniMax-H3" \
  -F "prompt=The camera slowly pushes in" \
  -F "seconds=5" \
  -F "size=1280x720" \
  -F "input_reference=@first-frame.png"

Supported request fields include:

  • model
  • prompt
  • seconds
  • size
  • input_reference.image_url
  • Multipart input_reference file

Video object

Create and retrieve operations return a consistent video object:

{
  "id": "video_task_id",
  "object": "video",
  "model": "MiniMax-H3",
  "status": "queued",
  "progress": 0,
  "created_at": 1712697600,
  "prompt": "A cinematic ocean sunrise",
  "seconds": "5",
  "size": "1280x720"
}

The public task states are:

  • queued
  • in_progress
  • completed
  • failed

Listing and content download

The video API supports:

  • Listing jobs owned by the current One API user
  • limit, order, and after list parameters
  • Downloading completed video content
  • Clear errors when video content is not ready
  • Cancelling or deleting a video job
  • Structured upstream and validation errors

Module 2: SiftQ Provider

Provider configuration

This PR adds SiftQ as an independent channel provider:

  • Provider: SiftQ
  • Model: MiniMax-H3
  • Default base URL: https://siftq.com/api/minimax/
  • Authentication: Bearer API key
  • Configurable channel base URL
  • Channel connectivity testing
  • MiniMax-H3 model-list registration
  • Channel load balancing
  • Administrator-specific channel selection

SiftQ has its own:

  • Channel type
  • API type
  • Adaptor
  • Model list
  • Base URL configuration
  • Request validation
  • Channel configuration UI

Video parameters

Supported sizes:

size Resolution Ratio
720x1280 768P 9:16
1280x720 768P 16:9
1024x1792 2K 9:16
1792x1024 2K 16:9

Defaults:

  • model: MiniMax-H3
  • seconds: 4
  • size: 720x1280

Video duration supports integer values from 4 through 15 seconds.

First-frame images can be provided as:

  • Public HTTP or HTTPS URLs
  • Base64 data URIs
  • Multipart file uploads

Asynchronous task ownership

Video task bindings persist the following information:

  • Task ID
  • One API user ID
  • One API token ID
  • SiftQ channel ID
  • Model
  • Prompt
  • Duration
  • Size
  • Creation time

Retrieve, list, download, and delete operations validate that the task belongs to the current user and continue using the channel that created it.

This prevents:

  • Cross-user access to video jobs
  • Load balancing from moving polling requests to another channel
  • Follow-up operations from using the wrong upstream account
  • One API or SiftQ credentials from being forwarded to video content URLs

Quota accounting

The MiniMax-H3 model supports per-second video quota accounting:

  • Quota is pre-consumed before job creation
  • Failed creation requests are refunded
  • Successful jobs record user and channel consumption
  • Retrieve, list, download, and delete operations do not consume quota again
  • Pricing remains configurable through the existing model ratio settings

Channel management UI

SiftQ channel configuration is included in all bundled themes:

  • default
  • berry
  • air

The UI supports:

  • SiftQ API keys
  • The MiniMax-H3 model
  • Default or custom base URLs
  • Channel enable and disable operations
  • Channel connectivity testing

Usage

Create a video:

curl http://127.0.0.1:3000/v1/videos \
  -H "Authorization: Bearer $ONE_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "MiniMax-H3",
    "prompt": "A cinematic ocean sunrise",
    "seconds": "5",
    "size": "1280x720"
  }'

Retrieve the job:

curl http://127.0.0.1:3000/v1/videos/<video_id> \
  -H "Authorization: Bearer $ONE_API_TOKEN"

Download the completed video:

curl http://127.0.0.1:3000/v1/videos/<video_id>/content \
  -H "Authorization: Bearer $ONE_API_TOKEN" \
  --output result.mp4

Verification

OpenAI-compatible Video APIs

  • Video route registration
  • One API token model permission handling
  • JSON request parsing
  • Multipart request parsing
  • Size and duration validation
  • First-frame image handling
  • Task state normalization
  • User-scoped task ownership
  • Structured error handling

SiftQ Provider

  • Provider and adaptor registration
  • Channel type and API type registration
  • MiniMax-H3 model-list registration
  • MiniMax-H3 presence in /api/channel/models
  • Default and custom base URL handling
  • Bearer authentication headers
  • Request and media validation
  • Structured upstream error handling
  • Channel configuration in all three bundled themes
  • Local manual verification with a configured SiftQ channel

Build and tests

  • gofmt
  • go test ./router ./controller ./middleware ./model ./relay/adaptor/siftq ./relay ./relay/channeltype
  • go build ./...
  • Default frontend production build

The repository-wide go test ./... run also reaches the existing network-dependent common/image TestDecode test. In the test environment, its Wikimedia fixture timed out and triggered the test's pre-existing nil dereference. This is unrelated to the changes in this PR; all affected packages and the complete Go build pass.

Screenshot

SiftQ channel registration

The screenshot confirms that SiftQ is registered as a distinct channel type and that a SiftQ provider channel can be created and enabled.

image image

I have verified that this PR works as described. The relevant screenshot is attached above.

Register SiftQ as an independent channel provider for the MiniMax-H3 model, with https://siftq.com/api/minimax/ as the default configurable base URL and bearer-token authentication.

Expose a provider-neutral OpenAI-style asynchronous video API:

- POST /v1/videos creates a video generation job
- GET /v1/videos/:video_id retrieves job state
- GET /v1/videos lists the current user's jobs
- GET /v1/videos/:video_id/content downloads completed output
- DELETE /v1/videos/:video_id cancels or deletes a job

Translate these public endpoints internally to the SiftQ MiniMax-H3 V2 create, query, and delete contracts. Normalize SiftQ task states and errors into OpenAI-compatible video objects and error envelopes, while keeping native /v2 routes private to the upstream adaptor.

Persist user, token, and channel task ownership so polling, download, listing, and deletion return to the channel that created the job. Add per-second quota accounting with refunds for failed submissions, model discovery, configurable channel UI support across all bundled themes, request and media validation, documentation, and acceptance evidence.

Add targeted coverage for route registration, the absence of public native /v2 ingress, JSON and multipart model extraction, size/duration/reference-image conversion, task-state normalization, URL joining, bearer headers, upstream errors, task ownership, model registration, and channel configuration.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add OpenAI-compatible video APIs and a SiftQ provider

1 participant